package com.zhanghu.backendZray.controller.entertainment;

import cn.hutool.core.collection.CollUtil;
import com.zhanghu.backendZray.pojo.dto.ApiResponse;
import com.zhanghu.backendZray.pojo.entity.WeeklyCinema;
import com.zhanghu.backendZray.service.WeeklyCinemaService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 娱乐
 * @author ZhangDong
 * @date 2024/9/18 22:20
 */
@RestController
@RequestMapping("entertainment")
@RequiredArgsConstructor
public class EntertainmentController {
    private final WeeklyCinemaService weeklyCinemaService;

    @GetMapping("weeklyCinema")
    public ApiResponse<WeeklyCinema> weeklyCinema() {
        List<WeeklyCinema> list = weeklyCinemaService.list();
        if (CollUtil.isNotEmpty(list)) {
            return ApiResponse.ok(list.get(0));
        }
        return ApiResponse.ok(null);
    }
}
